﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style x:Key="ScrollBarLineButton"
           TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels"
                Value="True" />
        <Setter Property="OverridesDefaultStyle"
                Value="true" />
        <Setter Property="Focusable"
                Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border x:Name="Border">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ColorAnimation Storyboard.TargetName="arrow"
                                                        Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)"
                                                        Duration="0"
                                                        To="Black" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                </VisualState>
                                <VisualState x:Name="Disabled" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Path x:Name="arrow"
                              HorizontalAlignment="Center"
                              VerticalAlignment="Center"
                              SnapsToDevicePixels="True"
                              Data="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}">
                            <Path.Fill>
                                <SolidColorBrush Color="#828689" />
                            </Path.Fill>
                        </Path>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ScrollBarPageButton"
           TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels"
                Value="True" />
        <Setter Property="OverridesDefaultStyle"
                Value="true" />
        <Setter Property="IsTabStop"
                Value="false" />
        <Setter Property="Focusable"
                Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="Transparent" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ScrollBarThumb"
           TargetType="{x:Type Thumb}">
        <Setter Property="SnapsToDevicePixels"
                Value="True" />
        <Setter Property="OverridesDefaultStyle"
                Value="true" />
        <Setter Property="IsTabStop"
                Value="false" />
        <Setter Property="Focusable"
                Value="false" />
        <Setter Property="Background"
                Value="#b9b9b9" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Background="{TemplateBinding Background}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsDragging"
                     Value="True">
                <Setter Property="Background"
                        Value="Black" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <ControlTemplate x:Key="VerticalScrollBar"
                     TargetType="{x:Type ScrollBar}">
        <Border Padding="{TemplateBinding BorderThickness}"
                BorderThickness="{TemplateBinding BorderThickness}"
                BorderBrush="{TemplateBinding BorderBrush}">
            <Grid Background="{TemplateBinding Background}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="12" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="12" />
                </Grid.RowDefinitions>
                <RepeatButton Grid.Row="0"
                              Style="{StaticResource ScrollBarLineButton}"
                              Height="12"
                              Command="ScrollBar.LineUpCommand"
                              Content="M 0 3 L 5 3 L 3 0 Z" />
                <Track x:Name="PART_Track"
                       Grid.Row="1"
                       IsDirectionReversed="true">
                    <Track.DecreaseRepeatButton>
                        <RepeatButton Style="{StaticResource ScrollBarPageButton}"
                                      Command="ScrollBar.PageUpCommand" />
                    </Track.DecreaseRepeatButton>
                    <Track.Thumb>
                        <Thumb Style="{StaticResource ScrollBarThumb}" />
                    </Track.Thumb>
                    <Track.IncreaseRepeatButton>
                        <RepeatButton Style="{StaticResource ScrollBarPageButton}"
                                      Command="ScrollBar.PageDownCommand" />
                    </Track.IncreaseRepeatButton>
                </Track>
                <RepeatButton Grid.Row="3"
                              Style="{StaticResource ScrollBarLineButton}"
                              Height="12"
                              Command="ScrollBar.LineDownCommand"
                              Content="M 0 0 L 3 3 L 5 0 Z" />
            </Grid>
        </Border>
    </ControlTemplate>

    <ControlTemplate x:Key="HorizontalScrollBar"
                     TargetType="{x:Type ScrollBar}">
        <Border Padding="{TemplateBinding BorderThickness}"
                BorderThickness="{TemplateBinding BorderThickness}"
                BorderBrush="{TemplateBinding BorderBrush}">
            <Grid Background="{TemplateBinding Background}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="12" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="12" />
                </Grid.ColumnDefinitions>
                <RepeatButton Grid.Column="0"
                              Style="{StaticResource ScrollBarLineButton}"
                              Width="12"
                              Command="ScrollBar.LineLeftCommand"
                              Content="M 3 0 L 3 6 L 0 3 Z" />
                <Track x:Name="PART_Track"
                       Grid.Column="1"
                       IsDirectionReversed="False">
                    <Track.DecreaseRepeatButton>
                        <RepeatButton Style="{StaticResource ScrollBarPageButton}"
                                      Command="ScrollBar.PageLeftCommand" />
                    </Track.DecreaseRepeatButton>
                    <Track.Thumb>
                        <Thumb Style="{StaticResource ScrollBarThumb}" />
                    </Track.Thumb>
                    <Track.IncreaseRepeatButton>
                        <RepeatButton Style="{StaticResource ScrollBarPageButton}"
                                      Command="ScrollBar.PageRightCommand" />
                    </Track.IncreaseRepeatButton>
                </Track>
                <RepeatButton Grid.Column="3"
                              Style="{StaticResource ScrollBarLineButton}"
                              Width="12"
                              Command="ScrollBar.LineRightCommand"
                              Content="M 0 0 L 3 3 L 0 6 Z" />
            </Grid>
        </Border>
    </ControlTemplate>

    <Style TargetType="{x:Type ScrollBar}">
        <Setter Property="SnapsToDevicePixels"
                Value="True" />
        <Setter Property="OverridesDefaultStyle"
                Value="true" />
        <Setter Property="BorderBrush"
                Value="#a7a9ac" />
        <Style.Triggers>
            <Trigger Property="Orientation"
                     Value="Horizontal">
                <Setter Property="Width"
                        Value="Auto" />
                <Setter Property="Height"
                        Value="11" />
                <Setter Property="Template"
                        Value="{StaticResource HorizontalScrollBar}" />
                <Setter Property="BorderThickness"
                        Value="0 0 0 1" />
                <Setter Property="Margin"
                        Value="0 2 0 0" />
            </Trigger>
            <Trigger Property="Orientation"
                     Value="Vertical">
                <Setter Property="Width"
                        Value="11" />
                <Setter Property="Height"
                        Value="Auto" />
                <Setter Property="Template"
                        Value="{StaticResource VerticalScrollBar}" />
                <Setter Property="BorderThickness"
                        Value="0 0 1 0" />
                <Setter Property="Margin"
                        Value="2 0 0 0" />
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>